package com.b2.controller.wx;

import com.b2.pojo.dto.*;
import com.b2.pojo.vo.DirectorGetworksVo;
import com.b2.pojo.vo.TeacherVideoInformation;
import com.b2.result.Result;
import com.b2.service.TeacherVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wx/teachervideo")
@Slf4j
@Api(tags = "微信老师上传视频及其园长处理相关接口")
@CrossOrigin
public class TeacherVideoController {

     @Autowired
     TeacherVideoService teacherVideoService ;

     //第一次提交解读视频
     @PostMapping ("commitvideo")
     @ApiOperation("老师提交解读视频")
    public Result teachercommitvideo(@RequestBody TeacherCommitVideoDto teacherCommitVideoDto){
        teacherVideoService.teachercommitvideo(teacherCommitVideoDto);
         return Result.success();
    }


    //查询自己提交得解读视频及园长回复
    @GetMapping("getinformation")
     @ApiOperation("老师查询自己提交得解读视频及园长回复")
    public Result<TeacherVideoInformation> getinformation( Long videoid,Long classid){
        TeacherVideoInformation teacherVideoInformation= teacherVideoService.getinformation(videoid,classid);
        return Result.success(teacherVideoInformation);
    }


    //查看是否可以修改
    @GetMapping("getstatus")
     @ApiOperation("老师查看是否可以修改")
    public Result<Integer> getstatus( Long id){
        Integer status= teacherVideoService.getstatus(id);
        return Result.success(status);
    }


    //老师修改解读视频
    @PostMapping ("updatevideo")
     @ApiOperation("老师修改解读视频")
    public Result teacherupdatevideo(@RequestBody teacherUpdateVideoDto teacherUpdateVideoDto){

        teacherVideoService.teacherupdatevideo(teacherUpdateVideoDto);
        return Result.success();
    }
    //园长得到工作
    @PostMapping ("dirctorgetworks")
     @ApiOperation("园长得到工作")
    public Result<List<DirectorGetworksVo>> dirctorgetworks(@RequestBody DirectorGetWorksDto directorGetWorksDto){

        List<DirectorGetworksVo> directorGetworksVos=  teacherVideoService.dirctorgetworks(directorGetWorksDto);
        return Result.success(directorGetworksVos);
    }

    @PostMapping("getAiresponse")
     @ApiOperation("获取AI回复")
    public String getAiresponse(@RequestBody AiDto aiDto){
        String AIresponse= teacherVideoService.getAiresponse(aiDto);
        return AIresponse;
    }

    @PostMapping("putDirectorResponse")
     @ApiOperation("园长回复")
    public Result putDirectorResponse(@RequestBody DirectorResponseDto dto){
        teacherVideoService.putDirectorResponse(dto);
        return Result.success();
    }

    @PostMapping("DirectorUpdateStatus")
     @ApiOperation("园长修改状态")
    public Result DirectorUpdateStatus(@RequestBody DirectorOverruleDto directorOverruleDto){
        teacherVideoService.DirectorUpdateStatus(directorOverruleDto.getId(), directorOverruleDto.getOverrule());
        return Result.success();
    }

}
